Repository navigation
Add Octavia project quota limits and resource usage reads - #2
Conversation
ConnectContext pings and closes the pool when the database does not answer, so a caller that starts during a database outage has no pool at all. The OpenStack database exporter then reports its services as down until it is restarted, even after the database is back. Open does the parsing and pool setup without contacting the server, and ConnectContext becomes Open plus the ping, so existing callers behave as before. The pool connects on first use and reconnects after a lost connection. Tested with go test -race, go vet, gofmt and the integration suite. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Timon Schnell <timon.schnell@btc-it-services.com>
cec81ee to
94b830e
Compare
adamhackl
left a comment
There was a problem hiding this comment.
Thanks. Counting each table independently, with no parent joins, is the right call, and the README is clear about how this differs from Octavia’s own counters. A few things:
-
Consider also exposing the cached in_use_* columns
GetUsage rebuilds counts from objects, but Octavia enforces quota against the cached in_use_* counters on the quotas table. When those drift, a project can be refused by Octavia while our metrics still show headroom, or the other way round. Returning the cached values next to the rebuilt counts would let consumers show what’s actually enforced and alert on drift. As written, that difference can’t be seen through the library. -
Two sources of truth for some counts
LoadBalancerCountByProject, ListenerCountByProject and PoolCountByProject repeat three of the seven arms of QuotaUsageGetAll. If someone later changes one predicate and not the other, the two APIs will report different numbers for the same thing. Is there a consumer that needs the per-resource versions? If not, I’d drop them. If they’re needed, what about the other four resources? -
Query cost on real schemas
QuotaUsageGetAll fully scans all seven tables on every call. member and l7rule can be large in busy deployments. Has anyone checked the query plan against a real Octavia schema to see whether project_id / provisioning_status are indexed? -
Owner filtering
QuotaGetAll keeps an empty-string project row, but the usage queries exclude it. That’s the same pattern as #4, so consumers joining limits to usage will have an unmatched row. Please align them, or note why the difference is intentional.
94b830e to
964a054
Compare
etimmons
left a comment
There was a problem hiding this comment.
That QuotaUsageGetAll query looks heavy with the UNION ALLs along with the WHERE clause on columns without an index. Probably not a problem now, but something to keep an eye on in the future.
Open adds no dial timeout, so a pool held through a database outage does not fail fast. Say so in the Open doc comment and the README, and move the Open note into its own README paragraph. Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
Add Open for a pool without the startup ping
964a054 to
e5d6e1b
Compare
Add three read-only Designate queries for openstack_database_exporter: - ZoneGetAll: non-deleted zones with status and type. - RecordsetCountByZone: recordset count per non-deleted zone, including zones with no recordsets, without reading individual records. - RecordsetGetAllWithStatus: recordsets with the status the Designate API reports (worst child record status in the order ERROR, PENDING, ACTIVE, DELETED; ACTIVE when a recordset has no records). Zone and recordset IDs are returned as dashed UUIDs, matching the API. Splitting the queries lets the exporter skip the per-recordset status query when that metric is disabled. Signed-off-by: Tadas Sutkaitis <tadas.sutkaitis@vexxhost.com>
Add two read-only Octavia quota queries and a QuotaRepository that wraps them: - QuotaGetAll (QuotaRepository.GetAll): one row per project from the quotas table, with the stored limits for all seven quota resources and Octavia's cached in_use_* counters, which check_quota_met and decrement_quota enforce against. Limits and counters are nullable; NULL, zero and -1 limits are returned as stored. - QuotaUsageGetAll (QuotaRepository.GetUsage): recounts load balancers, listeners, pools, members, health monitors, L7 policies and L7 rules per project with check_quota_met's predicate (the object's own project_id and provisioning_status != 'DELETED'). Each table is counted independently, so no parent join can multiply or drop counts, and projects without quota rows are included. Comparing the two reads shows counter drift. Octavia defines no index on project_id or provisioning_status, so the recount scans all seven object tables and suits a less frequent drift check rather than every scrape. Both reads exclude empty project IDs, which Octavia rejects. Add the quota and object tables to the Octavia schema fixture, unit tests, a MariaDB integration test with a fixture covering matching and drifted counters, smoke calls in TestOctaviaQueries, and API.md documentation. Co-authored-by: David Hulick <dave.hulick@gmail.com> Signed-off-by: David Hulick <dave.hulick@gmail.com> Signed-off-by: Jeremy Lee <jeremy.lee1664@gmail.com>
e5d6e1b to
d0c9d48
Compare
Add Octavia project quota limits and resource usage reads
Summary
Add read-only Octavia quota queries and repository methods for project quota limits, resource counts, and reconstructed quota usage across all seven Octavia resource types.
Changes
The changes are additive and preserve existing Octavia repository behavior. Schema additions are for code generation and testing, not production database migrations.